package com.mhkj.revise.draft.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mhkj.revise.draft.service.DraftService;
import com.mhkj.revise.plan.entity.Plan;
import com.mhkj.revise.plan.entity.PlanNode;
import com.mics.core.common.componet.JsonHandler;
import com.mics.core.common.componet.Pagination;
import com.mics.core.system.base.controller.BaseController;

/**
 * 草稿箱
 * @author mics
 * @date 2018年8月10日
 * @version 1.0
 */
@Controller
@RequestMapping("/draft")
public class DraftController extends BaseController<PlanNode>{
	@Resource
	private DraftService draftService;
	@Resource
	private JsonHandler jsonHandler;
	
	@RequestMapping("/listByPage")
	@ResponseBody
	public void listByPage(HttpServletResponse response,Plan plan,int pageIndex,int pageSize){
		Pagination<Plan> pagination =  draftService.listByPage(plan,pageIndex,pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination, new String[]{
				"id","name","planType.value","item.name","beginDate","endDate","createDate","state","auditDate","auditRemark","planType.code"}, 
				"id","name","planTypeValue","itemName","beginDate","endDate","createDate","state","auditDate","auditRemark","code");
	}
	
	
}
